2 572 - Oil deposits (UVa Online Judge)
3 1959 - Oil deposits (TJU Online Judge)
9 int di
[] = {-1, -1, -1, +0, +1, +1, +1, +0};
10 int dj
[] = {-1, +0, +1, +1, +1, +0, -1, -1};
17 void dfs(const int &i
, const int &j
){
18 if ( (0 <= i
&& i
< r
&& 0 <= j
&& j
< c
) == false){
21 if (v
[i
][j
] || g
[i
][j
] == '*') return;
25 for (int k
=0; k
<8; ++k
){
26 dfs(i
+ di
[k
], j
+ dj
[k
]);
32 while (cin
>> r
>> c
&& (r
+c
)){
33 for (int i
=0; i
<r
; ++i
){
34 for (int j
=0; j
<c
; ++j
){
41 for (int i
=0; i
<r
; ++i
){
42 for (int j
=0; j
<c
; ++j
){
43 if (!v
[i
][j
] && g
[i
][j
] == '@'){